local function main(userOb,msgData)
    if not msgData.pops1 or not msgData.pops2 then
        local res = {}
        res.code=400
        res.pops1 = msgData.pops1
        res.pops2 = msgData.pops2
        userOb:send_packet("MSGS2CComposeWeapons", res)
        return
    end

    if msgData.pops1 == msgData.pops2 then
        local res = {}
        res.code=401
        res.pops1 = msgData.pops1
        res.pops2 = msgData.pops2
        userOb:send_packet("MSGS2CComposeWeapons", res)
        return
    end

    local item1 = INVENTORY_D:get_prop_by_pos(userOb, msgData.pops1)
    if not item1 then
        local res = {}
        res.code=402
        res.pops1 = msgData.pops1
        res.pops2 = msgData.pops2
        userOb:send_packet("MSGS2CComposeWeapons", res)
        return
    end

    --!判断换位置
    local item2 = INVENTORY_D:get_prop_by_pos(userOb, msgData.pops2)
    if not item2 then
        item1.pops = msgData.pops2
        INVENTORY_D:add_prop_by_pos(userOb, msgData.pops2, item1)
        INVENTORY_D:remove_prop_by_pos(userOb, msgData.pops1)
    elseif item1.type ~= "weapon" or item1.propId ~= item2.propId then
        item1.pops, item2.pops = msgData.pops2, msgData.pops1
        INVENTORY_D:add_prop_by_pos(userOb, msgData.pops1, item2)
        INVENTORY_D:add_prop_by_pos(userOb, msgData.pops2, item1)
    else
        --!合并升级武器
        INVENTORY_D:remove_prop_by_pos(userOb, msgData.pops1)
        INVENTORY_D:improve_weapon_level(userOb, item2)
    end

    local res = {}
    res.code=200
    res.pops1 = msgData.pops1
    res.pops2 = msgData.pops2
    userOb:send_packet("MSGS2CComposeWeapons", res)
    ITEM_D:send_props_info(userOb)
end

--注册方法
COMMAND_D:register_command("MSGC2SComposeWeapons",GameCmdType.NONE, main)
